import TIM from '../sdk/tim-wx.js'
import Vue from 'vue'


export default {
    init(config) {
        console.log("*** tim installed ***")
		uni.$TIM_READY = false

		const tim = TIM.create({
			SDKAppID: config.SDKAppID
		})
		tim.setLogLevel(0)

		Vue.prototype.$tim = tim
		Vue.prototype.$TIM = TIM
		Vue.prototype.$TIM_INIT = function(id, sig) {
			uni.$app.$TIM_INIT.prototype = {...uni.$app.prototype, ...uni.$app.$TIM_INIT.prototype}
			tim.login({
				userID: id,
				userSig: sig
			})
			uni.$TIM_READY = true
		}
    }
}
